<?php
if( !defined('IN_INDEX') )
{
	die('This page is hidden.');
}
if(!checkSession())
{
	function redirect($url)
			{
			?>
				<script type="text/javascript">
					{
					window.location = "<?=$url?>";
					}
				</script>
			<?php 
			}
			redirect("index.php?action=login");
	exit;
}
else
{
	if(isset($_REQUEST['id']))
	{
		$USER_PROFILE = new User('id', $_REQUEST['id']);
		$page_url = "index.php?action=profile&id=" . $_REQUEST['id'] . "&sub=stats";
	}
	else
	{
		$USER_PROFILE = $USER;
		$page_url = "index.php?action=profile&sub=stats";
	}
}
include('inc/functions_blog.php');
$blogs = getTrainingList(" WHERE user_id='" . $USER_PROFILE->getId() . "'");
?>
<div id='postpath'>
		<a title="<?php echo translate('gotofrontpage'); ?>" href="index.php"><?php echo translate('home'); ?></a>
		 &gt; <a href="index.php?action=blogs" title='<?php echo translate('showallblogs'); ?>'><?php echo translate('blog'); ?></a> 
         &gt; <a href="index.php?action=profile&id=<?php echo $USER_PROFILE->getId(); ?>"><?php echo ucf($USER_PROFILE->getFirstname()) . " " . ucf($USER_PROFILE->getLastname()); ?></a>
		&gt; <a href="index.php?action=profile&sub=stats&id=<?php echo $USER_PROFILE->getId(); ?>" title='<?php echo translate('stats'); ?>'><?php echo translate('stats'); ?></a>
</div>
<?php 
if(count($blogs) > 0)
{
?>
<br />
<h1><?php echo translate('stats'); ?></h1>

<table border="0" cellpadding="5">
    <tr>
        <td>
        <center>
        <a style='color:#555555;' href="index.php?action=profile&sub=stats_general&id=<?php echo $USER_PROFILE->getId(); ?>">
        <h2><?php echo translate('general'); ?></h2>
        <img src="./img/stats/stats_general.JPG" alt="<?php echo translate('general'); ?>" />
        <br />
        <?php echo translate('stats_subtext'); ?>
        </a>
        </center>
        </td>
        
        <td>
        <center>
        <a style='color:#555555;' href="index.php?action=profile&sub=stats_progress&id=<?php echo $USER_PROFILE->getId(); ?>">
        <h2><?php echo translate('myprogress'); ?></h2>
        <img src="./img/stats/stats_progress.JPG" alt="<?php echo translate('myprogress'); ?>" />
        <br />
        <?php echo translate('myprogress_text'); ?>
        </a>
        </center>
        </td>
        
         <td>
         <center>
         <a style='color:#555555;' href="index.php?action=profile&sub=stats_volume&id=<?php echo $USER_PROFILE->getId(); ?>">
        <h2><?php echo translate('volume'); ?></h2>
        <img src="./img/stats/stats_volume.JPG" alt="<?php echo translate('volume'); ?>" />
        <br />
        <?php echo translate('volume_subtext'); ?>
        </a>
        </center>
        </td>
        
    </tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
    
        <td>
        <center>
        <a style='color:#555555;' href="index.php?action=profile&sub=stats_bw&id=<?php echo $USER_PROFILE->getId(); ?>">
        <h2><?php echo translate('bodyweight'); ?></h2>
        <img src="./img/stats/stats_bodyweight.JPG" alt="<?php echo translate('bodyweight'); ?>" />
        <br />
        <?php echo translate('bodyweight_subtext'); ?>
        </a>
        </center>
        </td>
        
        <td>
        <center>
        <a style='color:#555555;' href="index.php?action=profile&sub=stats_lifted&id=<?php echo $USER_PROFILE->getId(); ?>">
        <h2><?php echo translate('lifted'); ?></h2>
        <img src="./img/stats/stats_lifted.JPG" alt="<?php echo translate('lifted'); ?>" />
        <br />
        <?php echo translate('lifted_subtext'); ?>
        </a>
        </center>
        </td>
		<td>
        <center>
        <a style='color:#555555;' href="index.php?action=profile&sub=stats_awards&id=<?php echo $USER_PROFILE->getId(); ?>">
        <h2><?php echo translate('awards'); ?></h2>
        <img src="./img/stats/stats_lifted.JPG" alt="<?php echo translate('awards'); ?>" />
        <br />
        <?php echo translate('awards_subtext'); ?>
        </a>
        </center>
        </td>
    </tr>
</table>
<br />
<?php
}
else
{
  echo "<br /><br /><br /><br /><br /><br /><br /><br /><br />
		<center><h2>" . translate('addanewtrainingtostart') . "</h2></center>";
}
?>